import {
  BASE_URL_METADATA,
  CLIENT_NAME_METADATA,
  DEFAULT_CLIENT_NAME,
} from './constants';

export interface ClientParams {
  name?: string;
}

export function Client(params?: ClientParams) {
  return (target: any) => {
    const clientName = params?.name || DEFAULT_CLIENT_NAME;
    Reflect.defineMetadata(CLIENT_NAME_METADATA, clientName, target);
    target.clientName = clientName;
  };
}

export function Api(baseUrl?: string) {
  return (target: any) => {
    Reflect.defineMetadata(BASE_URL_METADATA, baseUrl || '', target);
    target.baseUrl = baseUrl;
  };
}
